﻿using Youz.Common.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;

namespace Youz.CreditRepay.Server.Ajax
{
    /// <summary>
    /// ValidateCode 的摘要说明
    /// </summary>
    public class ValidateCodeImg : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            string checkCode = ValidateCode.GetRandomCode();
            context.Session["ValidateCode"] = checkCode;
            context.Response.ContentType = "image/jpeg";
            context.Response.BinaryWrite(ValidateCode.CreateCodeImage(checkCode).ToArray());
            context.Response.End();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}